package com.example.administrator.xiaobo.adapter;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.example.administrator.xiaobo.R;
import com.example.administrator.xiaobo.jsonbean.MovieJsonBean;

import java.util.List;

/**
 * Created by Administrator on 2017/2/8.
 */

public  class MovieAdapter extends SimpleAdapter<MovieJsonBean.DataBean> {
   private Context context;

    public MovieAdapter(Context context, List<MovieJsonBean.DataBean> datas) {
        super(context, datas, R.layout.movie_item);
        this.context=context;
    }


    @Override
    public void bindData(BaseViewHolder holder, MovieJsonBean.DataBean dataBean) {
        Glide.with(context).load(dataBean.getLimage().getLevel1()).centerCrop().into(holder.getImageView(R.id.movie_image));
        holder.getTextView(R.id.name_up).setText(dataBean.getLname());
        holder.getTextView(R.id.name_bellow).setText(dataBean.getLiveplatform().getName());
        holder.getTextView(R.id.name_bellow2).setText(dataBean.getName());
        holder.getTextView(R.id.movie_people).setText(dataBean.getOnlinecount()+"");
        if (dataBean.getLstatus()==1){
            holder.getImageView(R.id.movie_staus).setImageResource(R.mipmap.live_living);
        }else {
            holder.getImageView(R.id.movie_staus).setImageResource(R.mipmap.live_dead);
        }
    }
}
